<?php
if ($this->session->userdata('logged_in') == TRUE) {
    $this->load->view('view_login_success');
}
?>
<?php $this->load->view('view_pageheader'); ?>
<label class="content_linkBack"><a onClick='window.history.go(-1)'>< Back</a></label>
<label class="content_this">| GROUP MENU</label>
<style type="text/css">
    table.register {
        margin: auto;
        margin-top: 5px;
        border: #010101 solid 1px;
        border-left-style: none;
        border-right-style: none;
        text-align: center;
        padding: 5px 5px;
    }
    table.register th {
        color: #000;
        border: #ecebeb solid 1px;
    }
    table.register td {
        border: #ecebeb solid 1px;
    }
    table.register tr:hover {
        background-color: #ffcc99;
    }
    table.register tr td > input {
        cursor: pointer;
    }
</style>
<script type="text/javascript">
    function select_group_menu_id() {
        group_active.submit();
    }
</script>
<div style="border: red hidden 1px; width: 100%;">
    <table border="0" cellpadding="5" class="register">
        <tr style="text-align: right; background: #fff;">
            <td colspan="5">
                <form action="group_menu" id="group_active" name="group_active" method="post">
                    <div style="margin-top: 17px;">
                        <label>เลือกรูปแบบการแสดง : </label>
                        <select id="group_menu_type" name="group_menu_type" onchange="select_group_menu_id();">
                            <option value="-1">Choose...</option>
                            <option value="0">Non-Register</option>
                            <option value="1">Register</option>
                            <option value="2">Default</option>
                        </select>
                    </div>
                </form>
            </td>
            <td>
                <div align="center">
                    <a href="new_gmenu"><img style="width: 20px; height: 20px;"  src="../../images/new.png" /></a>
                </div>
            </td>
        </tr>
        <tr style="background-color: #fff">
            <th>ID</th>
            <th>GROUP MENU</th>
            <th>POSITION</th>
            <th>ACTIVE</th>
            <th>EDIT</th>
            <th>DELETE</th>
        </tr>
        <?php foreach ($gmenu as $show) { ?>
            <tr>
                <td><?php echo $show->gmenu_id . "<br />"; ?></td>
                <td><?php echo $show->gmenu_name . "<br />"; ?></td>
                <td><?php echo $show->position . "<br />"; ?></td>
                <td>
                    <form action="group_menu" id="activegmenu" name="activegmenu" method="post">
                        <?php
                        if ($show->active != "1") { // check false;
                            echo '<input type="image"  name="activegmenu" src="../../images/check_false.png" value="' . $show->active . $show->gmenu_id . '" />';
                        } else {
                            echo '<input type="image" name="activegmenu" src="../../images/check_true.png" value="' . $show->active . $show->gmenu_id . '" />';
                        }
                        ?>
                    </form>
                </td>
                <td>
                    <form action="edit_gmenu" id="" name="formmenu7" method="post">
                        <?php
                        echo '<input type="image" src="../../images/4.png" name="image" />';
                        echo '<input type="hidden" name="editgmenu" value="' . $show->gmenu_id . '" />';
                        ?>
                    </form>
                </td>
                <td>
                    <form action="group_menu" id="" name="formmenu2" method="post">
                        <?php
                        echo '<input type="image" name="deletegmenu" src="../../images/5.png" value="' . $show->gmenu_id . '" />';
                        ?>
                    </form>
                </td>
            </tr>
        <?php } ?>
    </table>
</div>
<?php $this->load->view('view_pagefooter'); ?>
